package cn.iocoder.yudao.module.project.dal.mysql.weighthistory;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.project.dal.dataobject.weighthistory.WeightHistoryDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.project.controller.admin.weighthistory.vo.*;

/**
 * 称重业务 Mapper
 *
 * @author 武汉华诚
 */
@Mapper
public interface WeightHistoryMapper extends BaseMapperX<WeightHistoryDO> {

    default PageResult<WeightHistoryDO> selectPage(WeightHistoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WeightHistoryDO>()
                .eqIfPresent(WeightHistoryDO::getInternalCode, reqVO.getInternalCode())
                .eqIfPresent(WeightHistoryDO::getScaleId, reqVO.getScaleId())
                .likeIfPresent(WeightHistoryDO::getScaleName, reqVO.getScaleName())
                .eqIfPresent(WeightHistoryDO::getIp, reqVO.getIp())
                .eqIfPresent(WeightHistoryDO::getPort, reqVO.getPort())
                .eqIfPresent(WeightHistoryDO::getWeight, reqVO.getWeight())
                .eqIfPresent(WeightHistoryDO::getWeightStatus, reqVO.getWeightStatus())
                .eqIfPresent(WeightHistoryDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(WeightHistoryDO::getCreateTime, reqVO.getCreateTime())
                .betweenIfPresent(WeightHistoryDO::getOperatingTime, reqVO.getOperatingTime())
                .orderByDesc(WeightHistoryDO::getId));
    }




    List<WeightHistoryDO> selectSavedList(Map<String, Object> params);

    void insertList(List<WeightHistoryDO> insertList);

    void updateList(List<WeightHistoryDO> updateList);

    List<WeightHistoryReportVO> selectWeightHistory(Map<String, Object> params);

    Long countWeightHistory(Map<String, Object> params);

    void clearWeightHistory(Map<String, Object> params);

}